package com.cwvs.cat.bean;

import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;


public class MyFriend {


	public String uid;
	public String name;
	public String nickname;
	public String avatar;
	public String gender;
	public String sign;
	
	public MyFriend(){
	}
	
	public MyFriend(List<String> list){
		this.uid = list.get(0);
		this.name = list.get(1);
		this.nickname = list.get(2);
		this.avatar = list.get(3);
		this.gender = list.get(4);
		this.sign = list.get(5);
	}
	
	
	public void fromJson(JSONObject json) {
		uid = json.optString("uid");
		name = json.optString("name");
		nickname = json.optString("nickname");
		avatar = json.optString("avatar");
		gender = json.optString("gender");
		sign = json.optString("sign");
	}

	public JSONObject toJson() {
		JSONObject json = new JSONObject();
		try {
			
			json.put("uid", uid);
			json.put("name", name);
			json.put("nickname", nickname);
			json.put("avatar", avatar);
			json.put("gender", gender);
			json.put("sign", sign);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return json;
	}

	public static MyFriend createFromJson(JSONObject json) {
		MyFriend user = new MyFriend();
		user.fromJson(json);
		return user;
	}
	
	
}
